
<main class="dux-cart" data-dux="cart-submit">
    <!--if{!empty($addInfo)}-->
    <a class="dux-cart-address am-cf" href="{url('order/Address/index', ['action' => url()])}">
        <div class="head">
            <span class="name">{$addInfo.name}</span>
            <span class="tel">{$addInfo.tel}</span>
            <!--if{$addInfo.default}-->
            <span class="am-badge am-badge-danger">默认</span>
            <!--{/if}-->
        </div>
        <div class="foot">
            <i class="am-icon-map-marker"></i> {$addInfo.province}{$addInfo.city}{$addInfo.region}{$addInfo.address}
        </div>
    </a>
    <!--{else}-->
    <div class="dux-box">
        <form class="am-form dux-form  dux-form-right" action="{url('order/Address/add')}" method="post"
              data-dux="form-bind"  data-advanced="false" data-callback="addressSava">
            <div class="am-input-group">
                <span class="am-input-group-label">姓名</span>
                <input type="text" class="am-form-field" placeholder="收件人姓名" name="name" value="{$info.name}">
            </div>
            <div class="am-input-group">
                <span class="am-input-group-label">电话</span>
                <input type="text" class="am-form-field" placeholder="收件人电话" name="tel" value="{$info.tel}">
            </div>
            <div id="distpicker">
                <div class="am-input-group">
                    <span class="am-input-group-label">省份</span>
                    <select name="province" class="am-form-field" data-province="{$info.province}"></select>
                </div>
                <div class="am-input-group">
                    <span class="am-input-group-label">城市</span>
                    <select name="city" class="am-form-field" data-city="{$info.city}"></select>
                </div>
                <div class="am-input-group">
                    <span class="am-input-group-label">地区</span>
                    <select name="region" class="am-form-field" data-district="{$info.region}"></select>
                </div>
            </div>
            <div class="am-input-group">
                <span class="am-input-group-label">地址</span>
                <input type="text" class="am-form-field" placeholder="详细地址到门牌号" name="address" value="{$info.address}">
            </div>
            <div class="am-input-group">
                <span class="am-input-group-label">邮编</span>
                <input type="text" class="am-form-field" placeholder="邮政编码" name="zip" value="{$info.zip}">
            </div>
            <div class="am-padding">

                <input type="hidden" name="default" value="1">
                <input type="hidden" name="refresh" value="1">
                <button class="am-btn am-btn-danger am-btn-block" type="submit" >
                    保存地址
                </button>
            </div>
        </form>
    </div>
    <!--{/if}-->
    <div class="dux-br"></div>
    <ul class="dux-pro-list">
        <!--loop{$pageList as $key => $vo}-->
        <li class="dux-pro-item am-cf">
            <div class="item-img">
                <img src="{$vo.image}" alt="">
            </div>
            <div class="item-info">
                <div class="title am-text-truncate">{str_len($vo.name, 18)}</div>
                <!--if{!empty($vo.options)}-->
                <p>
                    <!--loop{$vo.options as $v}-->
                    {$v.name}:{$v.value}
                    <!--{/loop}-->
                </p>
                <!--{/if}-->
                <p>
                     × {$vo.qty}
                </p>
                <p class="price">
                    {price_format($vo.total)} 元
                    <!--if{$vo.currency}-->
                    {$vo.currency.type ? '/' : '+'} <span data-currency="{$vo.currency.pay}" data-amount="{$vo.currency.amount}" data-decimal="{$vo.currency.decimal}">{$vo.currency.amount}</span> {$vo.currency.name}
                    <!--{/if}-->
                </p>

            </div>
        </li>
        <!--{/if}-->
    </ul>
    <!--if{$orderConfig.cod_status}-->
    <div class="dux-box">
        <div class="box-header">
            付款方式
        </div>
        <div class="box-body dux-cart-box">

            <ul class="select-box am-cf">
                <li class="{$urlParams.pay_type == 1 ? 'active' : ''}">
                    <a href="{url('', array_merge($urlParams, ['pay_type' => 1]))}">在线支付</a>
                </li>
                <li class="{$urlParams.pay_type == 2 ? 'active' : ''}">
                    <a href="{url('', array_merge($urlParams, ['pay_type' => 2]))}">货到付款</a>
                </li>
            </ul>
            <input name="pay_type" type="hidden" value="{$payType}">
        </div>
    </div>
    <!--{/if}-->
    <div class="cart-action-br"></div>
    <div class="cart-action am-cf">
        <div class="action-btn am-cf">
            <!--if{empty($addInfo)}-->
            <a href="javascript:;" class="btn-submit btn-submit-disabled" >
                请添加收货地址
            </a>
            <!--{else}-->
            <a href="javascript:;" class="btn-submit" data-url='{url("submit")}' data-submit>
                提交订单
            </a>
            <!--{/if}-->
        </div>
        <div class="action-count">
            <p class="total">合计: <em class="am-text-danger">{price_format($orderPrice + $deliveryPrice)}</em>
                <small> (含运费<span>{price_format($deliveryPrice)}</span>元)</small>
                <!--loop{$info.currency as $k => $v}-->
                <!--if{$v.type}-->
                + ( <span class="am-text-danger">{$v.money}</span> 元 / <span class="am-text-danger" data-count-currency="{$k}" data-decimal="{$v.decimal}">{$v.amount}</span> {$v.name} )
                <!--{else}-->
                + <span class="am-text-danger" data-count-currency="{$k}" data-decimal="{$v.decimal}">{$v.amount}</span> {$v.name}
                <!--{/if}-->
                <!--{/loop}-->
                ，共<em data-count-num>{$info.items}</em>件商品
            </p>

        </div>

    </div>

</main>
<script>
    window.addressSava = function () {
        location.reload();
    };
    Do('distpicker', function () {
        $(function () {
            $('#distpicker').distpicker();
        });
    });
</script>
